// String.slice
String.prototype.slice2=function(startIndex,endIndex){
    let str=''
   if(startIndex<0){
       startIndex=Math.max(startIndex+this.length,0)
   }
//    最主要是要记住这个
   if(startIndex>=this.length)return str
   if(endIndex<0){
       endIndex=Math.max(endIndex+this.length,0)
   }
   if(endIndex>this.length)endIndex=this.length
  
   for(let i=(startIndex||0);i<(endIndex||this.length);i++){
       str+=this[i]
   }
   return str
}
let str='kjg'
   console.log(str.slice2(0,33));